///@date:  2024/1/17
///@author:  leisiyu
///@description:项目渠道相关配置

//  环境配置
class EnvConfig {
  final String restfulUrl;
  final String graphQLUrl;
  EnvConfig({
    required this.restfulUrl,
    required this.graphQLUrl,
  });
}

//  环境声明
abstract class EnvState {
  //  环境key
  static const String envKey = "DART_DEFINE_APP_ENV";

  static const String debug = "debug";
  static const String test = "test";
  static const String release = "release";
}

class Env {
  //  获取当前环境
  static const appEnv = String.fromEnvironment(EnvState.envKey);

  ///外部获取渠道环境配置
  static EnvConfig get envConfig => _getEnvConfig();

  static final EnvConfig _debugConfig = EnvConfig(
    restfulUrl: "https://wv.widevision.com.cn/",
    graphQLUrl: "http://192.168.202.196:3000/",
  );

  static final EnvConfig _testConfig = EnvConfig(
    restfulUrl: "https://wv.widevision.com.cn/",
    graphQLUrl: "http://192.168.202.196:3000/",
  );

  static final EnvConfig _releaseConfig = EnvConfig(
    restfulUrl: "https://wv.widevision.com.cn/",
    graphQLUrl: "http://192.168.202.196:3000/",
  );


  static EnvConfig _getEnvConfig() {
    switch(appEnv) {

      case EnvState.debug:
        return _debugConfig;
      case EnvState.test:
        return _testConfig;
      case EnvState.release:
        return _releaseConfig;
      default:
        return _debugConfig;

    }
  }
}